fix(losses): add missing docstring entries for default parameters#8755
fix(losses): add missing docstring entries for default parameters#8755ericspod merged 5 commits intoProject-MONAI:devfrom
Conversation
- Add missing `alpha` parameter (default 2.0) to HausdorffDTLoss.__init__ docstring - Add "Defaults to X" notes to SoftclDiceLoss and SoftDiceclDiceLoss docstrings for `iter_`, `smooth`, and `alpha` parameters Signed-off-by: Shiran Yu <shiran.yu@bristol.ac.uk>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review infoConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Cache: Disabled due to data retention organization setting Knowledge base: Disabled due to 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughDocstring clarifications in three loss classes: SoftclDiceLoss and SoftDiceclDiceLoss docstrings now state default parameter values (iter_: 3; smooth: 1.0; and iter_: 3, alpha: 0.5, smooth: 1.0, respectively). HausdorffDTLoss init docstring now documents the alpha parameter. No changes to function signatures, logic, behavior, or exported/public declarations. Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR adds missing and incomplete default parameter documentation to loss function docstrings, following the convention established in PR #8701. The changes are purely documentary with no code logic modifications.
Changes:
- Added missing
alphaparameter documentation toHausdorffDTLoss.__init__inhausdorff_loss.py - Updated parameter descriptions in
cldice.pyto include default values for better API documentation
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| monai/losses/hausdorff_loss.py | Added missing docstring entry for alpha parameter (default 2.0) that was present in function signature but undocumented |
| monai/losses/cldice.py | Added "Defaults to X." to parameter descriptions for iter_, smooth, and alpha in SoftclDiceLoss and SoftDiceclDiceLoss classes |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@monai/losses/cldice.py`:
- Around line 163-165: The docstring parameter list is out of order: the
function/class signature declares alpha before smooth, but the docstring lists
smooth first; update the docstring in monai/losses/cldice.py to list alpha
before smooth (and ensure the descriptions match the signature order for
parameters alpha and smooth, e.g., alpha: ... then smooth: ...), referencing the
initializer/function name (CLDice or its __init__/forward where the signature
appears) so the docstring aligns with the actual parameter order.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting
📒 Files selected for processing (2)
monai/losses/cldice.pymonai/losses/hausdorff_loss.py
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Eric Kerfoot <17726042+ericspod@users.noreply.github.com>
Description
Fixes missing and incomplete docstring parameter documentation in two loss files, consistent with the pattern established in #8701.
Changes
monai/losses/hausdorff_loss.pyHausdorffDTLoss.__init__: Added missingalphaparameter (default2.0) to theArgssection. The parameter was present in the function signature but completely absent from the docstring.monai/losses/cldice.pySoftclDiceLoss.__init__: AddedDefaults to X.toiter_andsmoothparameter descriptions.SoftDiceclDiceLoss.__init__: AddedDefaults to X.toiter_,smooth, andalphaparameter descriptions.Motivation
These are pure docstring fixes — no code logic was changed. The missing
alphadocumentation inHausdorffDTLossis the primary fix, and thecldice.pychanges follow the same "document defaults" pattern from #8701.Checklist